function fig2_right
close all
addpath ../

p = params;

set(0, 'defaulttextinterpreter','latex');
set(0,'defaulttextfontsize',12);

%----------------------------------------
p.delta = 0.1;

s1 = base(p);

v1 = s1.y(1:end-1,:);
h1 = s1.y(end,:);
t1 = s1.x;

t1_asy = logspace(log10(t1(2)), log10(t1(end)), 30);
h1_asy = -(1 + lambertw(-p.beta / (p.beta - 1) * exp(((-p.beta + p.delta * t1_asy) / (p.beta - 1))))) * (p.beta - 1);


v1_short = sep_var(0, p);


%--------------------------------------------
% now plot the t = O(1) stuff

subplot(2,1,1);

eta = linspace(0, 1, p.N)';
t = logspace(-6, -1, 10);

tmp = interp2(eta, t1, v1', eta, t);

plot(eta, tmp(1,:), 'k', 'linewidth',1);
hold on;
for i = 2:length(t)
    plot(eta, tmp(i,:), 'k', 'linewidth',1,'HandleVisibility','off');
end

eta = linspace(0, 1, 25)';
tmp = interp2(linspace(0, 1, p.N)', t1, v1_short', eta, t);

plot(eta, tmp, 'k*');
ylim([-0.008, 0]);

l = legend('numerical','asymptotic','location','southwest');
set(l, 'interpreter','latex','fontsize',11);

xlabel('$z / h(t)$');
ylabel('$c$');
%--------------------------------------------
% now plot the t = O(1 / delta) stuff

subplot(2,1,2);
eta = linspace(0, 1, p.N)';

t = logspace(-1, 3, 10);

tmp = interp2(eta, t1, v1', eta, t);
plot(eta, tmp, 'k', 'linewidth',1);
hold on;

eta = linspace(0, 1, 25)';

h1_asy = -(1 + lambertw(-p.beta / (p.beta - 1) * exp(((-p.beta + p.delta * t) / (p.beta - 1))))) * (p.beta - 1);
v1_long = (1 - p.beta) * (1 - 1 ./ h1_asy);
plot(eta, v1_long' * ones(size(eta))', 'k*');
xlabel('$z / h(t)$');
ylabel('$c$');
